#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2017/9/27 17:26
# @Author  : shwy
# @Site    : http://ishwy.me
# @File    : url.py
# @Software: PyCharm

import urllib
import urllib2
import cookielib

cj = cookielib.LWPCookieJar()

opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)

req = urllib2.Request('http://www.dayin.la/apps/stamp.html')

operate = opener.open(req)

msg = operate.read()

file_obj = open('E://code/a.txt','w')
file_obj.write(msg)
file_obj.close()